"""
高阶函数/Higher-order function

函数

def

"""

import functools

print(abs(-90))

print(abs)


# <built-in function abs>


def reverse(a):
    return -a


print(sorted([1, 23, 124, 23, 423, 534, 65456, 45, 6, 56, 4]))
print(sorted([36, 5, -12, 9, -21], key=abs))

print(sorted([36, 5, -12, 9, -21], key=reverse))
print(sorted(['bob', 'about', 'Zoo', 'Credit'], key=str.lower))

# 匿名函数

print('*' * 90)

r = map(lambda x: x * x, [1, 2, 3, 4, 5, 6, 7])
print(r)
print(list(r))


def f(x):
    return x * x


print(int('12345', base=8))
print(int('AA12345', base=16))
print(int('12345', base=10))
print(int('1010101', base=2))
int2 = functools.partial(int, base=2)
print(int2('1010101'))

# https://docs.python.org/zh-cn/3/library/functions.html
# https://www.anaconda.com/products/individual



